package com.atguigu.gmall.product.rpc;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.product.service.BaseCategory1Service;
import com.atguigu.gmall.product.to.CategoryTreeTo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author:lyd
 * @Date:2023/8/18 18:51
 * @Version:1.0
 * @Description
 **/
@RestController
@RequestMapping("/api/inner/product")
public class CategoryTreeRpcController {

    @Autowired
    private BaseCategory1Service baseCategory1Service;

    /**
     * 获取所有分类的列表
     * @return
     */
    @GetMapping("/getCategoryTree")
    public Result getCategoryTree() {
        List<CategoryTreeTo> list = baseCategory1Service.getCategoryTree();
        return Result.ok(list);
    }
}
